//https://leetcode.cn/problems/he-wei-sde-liang-ge-shu-zi-lcof/description/

class Solution {
public:
    vector<int> twoSum(vector<int>& price, int target) {
        int left = 0;
        int right = price.size() - 1;

        while (left < right) {
            int ret = price[left] + price[right];

            if (ret == target) {
                break;
            }
            else if (ret > target) {
                right--;
                continue;
            }
            else if (ret < target) {
                left++;
                continue;
            }
        }
        vector<int> r;
        r.push_back(price[left]);
        r.push_back(price[right]);
        return r;
    }
};